<#-- @ftlvariable name="entity" type="com.xci.platform.auth.entity.ReleaseHistoryEntity" -->
<#include "/_inc/_layout.ftl">
<#assign url=html.saveUrls("/auth/release-history/create-save","/auth/release-history/edit-save")/>
<@header/>
<div class="jxpanel winpanel" data-fit="true">
    <form id="editform" class="jxform" method="post" action="${url}">
        <input name="id" value="${entity.id!}" type="hidden">
        <table class="table jxtable-form" style="width: 96%">
            <tr>
                <th class="w-100px">版本号</th>
                <td>
                    <input class="form-control" id="version" name="version" value="${entity.version!}" maxlength="30"
                           data-validate="required: [true,'请输入版本号'],maxlength: 30" autocomplete="off"/>
                </td>
                <th>颜色</th>
                <td>
                    <#assign color=entity.colorSchema!>
                    <select id="colorSchema" name="colorSchema" class="form-control jxselect" data-allow-clear="false">
                        <option value="primary" data-color="2e6da4" <@html.isSelected value=color=="primary"/>>primary</option>
                        <option value="success" data-color="3f903f" <@html.isSelected value=color=="success"/>>success</option>
                        <option value="warning" data-color="f0ad4e" <@html.isSelected value=color=="warning"/>>warning</option>
                        <option value="danger" data-color="d9534f" <@html.isSelected value=color=="danger"/>>danger</option>
                        <option value="info" data-color="5bc0de" <@html.isSelected value=color=="info"/>>info</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th style="vertical-align: top">新增内容</th>
                <td colspan="3">
                    <textarea id="newContent" name="newContent">${entity.newContent!}</textarea>
                </td>
            </tr>
            <tr>
                <th style="vertical-align: top">修复内容</th>
                <td colspan="3">
                    <textarea id="fixContent" name="fixContent">${entity.fixContent!}</textarea>
                </td>
            </tr>
            <tr>
                <th style="vertical-align: top">优化内容</th>
                <td colspan="3">
                    <textarea id="optimizeContent" name="optimizeContent">${entity.optimizeContent!}</textarea>
                </td>
            </tr>
        </table>
    </form>
    <div class="panel-footer text-right">
        <@html.editPanelFooterSave/>
    </div>
</div>
<@footer>
<@html.ueScript/>
<script>
    function setVersionStyle() {
        var color = $('#colorSchema').find(':selected').data('color');
        $('#version').css('color', 'white').css('backgroundColor', '#' + color);
    }

    function initUEditor() {
        var ops = $.extend({}, jx.auth.simpleUEOptions(),{serverUrl:'<@html.ueditorServerUrl/>'});
        UE.getEditor('newContent', ops);
        UE.getEditor('fixContent', ops);
        UE.getEditor('optimizeContent', ops);
    }

    $('#colorSchema').on('change', function () {
        setVersionStyle();
    });

    jx.auth.bindEditFormSuccess();
    setVersionStyle();
    initUEditor();
</script>
</@footer>